<link rel="stylesheet" href="${request.contextPath}/red/css/style.css">
<#-- <script src="${request.contextPath}/red/js/jquery-1.11.3.min.js"></script> -->
 <div class="cover-bg" style="display:none;z-index:90" id="cover_bg_div_id"></div>
 	<input type="hidden" id="red_packet_in_id" />
    <div class="red-box red-btn" style="display:none;" id="red_box_div_id">
        <div class="pic"><img src="${request.contextPath}/red/images/red1.png" id="red_change_pic"></div>
        <h4><a class="close" href="javascript:;" id="h4_a_close_id"><img src="${request.contextPath}/red/images/close.png"></a></h4>
        <p id="red_change_p_id"><a onclick="getRed()" style="cursor:pointer;"><img src="${request.contextPath}/red/images/btn.png"></a></p>
    </div>
<script type="text/javascript">
	var canReload=false;
    $(function(){
        $("#h4_a_close_id").on("click",function(){ //初始化
            $("#red_box_div_id").css("display","none");
            $("#cover_bg_div_id").css("display","none");
            $("#red_change_pic").attr("src","${request.contextPath}/red/images/red1.png");
            if(canReload)
            	window.location.reload();
        })
    })
    
    function getRed(){
    	var orderId = $("#red_packet_in_id").val();
    	$.post("${request.contextPath}/pc/user/get_red_packet",{orderId:orderId},function(data){
    		if(data.status="success"){
    			var money = data.packet;
    			$("#red_change_pic").attr("src","${request.contextPath}/red/images/red.png");
    			$("#red_change_p_id").html(money+"元");
    			canReload = true;
    		}else{
    			alert("操作错误");
    		}
    		
    	});
    }
</script>

